<template>
	<view class="page_box">
		<view class="head_box ">
			<yy-custom bgColor="bg-gradual-blue" v-if="0">
				<block slot="backText">返回</block>
				<block slot="content">导航栏</block>
			</yy-custom>
		</view>

		<view class="content_box">
			<view class="head bg-img padding-lg flex  align-center justify-start">
				<view class="bg-white flex align-center justify-center round" style="width: 115rpx; height: 115rpx;">
					<image :src="data.headimgurl" mode="aspectFill" style="width: 110rpx; height: 110rpx;"
						class="round "></image>
				</view>

				<!-- <view class="cu-avatar round lg bg-gray">
					<image
						:src="data.headimgurl"
						mode="aspectFill"
						class="round"
						style="width: 100%; height: 100%;"
					></image>
				</view> -->
				<view class="flex flex-direction margin-left justify-around">
					<view class="flex align-center ">
						<text class="f34 text-light text-bold">
							{{ data.nickname ? data.nickname : '平台用户' }}
						</text>
						<view class="tag flex align-center justify-around margin-left-sm" v-if="data.level">
							<text class="cuIcon-favorfill margin-right-xs" style="color: #fbb03b;"></text>
							<text class="f26 text-white">{{ data.level }}</text>
						</view>
					</view>
					<text class="f-126 margin-top-xs" style="color: #484848;">{{ data.tel }}</text>
				</view>
			</view>
			<view class="agnt padding flex justify-between">
																		<!--   点击进入页面  @click="jump('/pages/personalCtr/upgRvw')" -->
				<view class="agnt-inside padding flex justify-between" >
					<view class="flex flex-direction justify-around">
						<text class="f30 text-bold ">待审批项</text>
						<text class="f24 text-gray">
							当前
							<text class="margin-lr-xs" style="color: #FBB03B;">{{numOf}}</text>
							条待审批
						</text>
					</view>
					<view class=" flex align-center">
						<image src="../../static/sh.png" mode="" style="width: 49rpx; height: 59rpx;"></image>
					</view>
				</view>
				<view class="agnt-inside padding flex justify-between" @click="jump('/pages/personalCtr/myScores')">
					<view class="flex flex-direction justify-around">
						<text class="f30 text-bold ">我的积分</text>
						<text class="f24 text-gray">
							当前积分：
							<text class="margin-lr-xs" style="color: #FBB03B;">{{jifeng}}</text>
						</text>
					</view>
					<view class=" flex align-center">
						<image src="../../static/jf.png" mode="" style="width: 49rpx; height: 59rpx;"></image>
					</view>
				</view>
			</view>
			<view class="setUp padding">
				<view class="setUp-inside padding-tb solid-bottom flex justify-between" v-for="(item, index) in setUp"
					:key="index" @click="jump(item.to)">
					<view class="flex">
						<image :src="item.icon" mode="aspectFill" class="" style="width: 44rpx; height: 44rpx;"></image>
						<text class="margin-left f30">{{ item.name }}</text>
					</view>
					<text class="cuIcon-right"></text>
				</view>
			</view>
		</view>


		<u-popup v-model="show" mode="center" border-radius="10">
			<view class="box-header">
				<view class="text">
					请选择等级
				</view>
				<view class="radion">
					<u-radio-group v-model="value" @change="radioGroupChange">
						<u-radio v-for="(item, index) in list" :key="index" :name="item.name"
							:disabled="item.disabled">
							{{item.name}}
						</u-radio>
					</u-radio-group>
				</view>
			</view>
		</u-popup>



		<view class="foot_box"></view>
		<!-- 登录提示 -->
		<yy-login v-if="false"></yy-login>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				setUp: [{
						name: '邀请好友',
						icon: '../../static/yaoqing.png',
						to: '/pages/personalCtr/inviteFriends'
					},
					{
						name: '邀请记录',
						icon: '../../static/yqjl.png',
						to: '/pages/personalCtr/invitationRec'
					},
					{
						name: '我的业绩',
						icon: '../../static/yj.png',
						to: '/pages/personalCtr/myPerformance'
					},
					{
						name: '平级订单',
						icon: '../../static/dd.png',
						to: '/pages/personalCtr/parallelOrdr'
					},
					{
						name: '地址管理',
						icon: '../../static/dz.png',
						to: '/pages/personalCtr/addrManagement'
					},
					{
						name: '账号设置',
						icon: '../../static/sz.png',
						to: '/pages/personalCtr/acctSettings'
					},
					{
						name: '关于我们',
						icon: '../../static/gywm.png',
						to: '/pages/personalCtr/aboutUs'
					},
				],
				data: {},
				numOf: '',
				show: false,
				
				
				list: [{
						name: 'A',
						disabled: false
					},
					{
						name: 'B',
						disabled: false
					},
					{
						name: 'C',
						disabled: false
					}
				],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				value: 'A',
				jifeng: '',
			};
		},
		onShow() {
			this.gettingInfo();
			this.viewTheNum()
			this.earnPoints()
		},
		onLoad(e) {

		},
		methods: {
			async gettingInfo() {
				const res = await this.$u.get('user/' + uni.getStorageSync('data').id, {}, {});
				if (res.code == 1) {
					return false;
				}
				this.data = res.data;
				uni.setStorageSync('userInfosell', this.data)
			},
			jump(url) {
				console.log('url: ', url);

				if (url === '/pages/personalCtr/inviteFriends') {
					this.show = true
				} else {
					uni.navigateTo({
						url
					});
				}
			},
			
			confirm() {
				this.show1 = false
				uni.removeStorageSync('data');
				uni.navigateTo({
					url: '/pages/login/login'
				})
			},
			
			async earnPoints(type = '') {
				let obj = {
					userId: uni.getStorageSync('data').id,
					size: 10,
					current: 1,
					type
				};
				const res = await this.$u.get('score/myScore', obj, {});
				this.jifeng = res.data.totle;
			},
			
			//查看条数
			async viewTheNum() {
				let obj = {
					id: uni.getStorageSync("data").id,
				};
				const res = await this.$u.get("user/pending", obj, );
				if (res.code == 0) {
					this.numOf = res.data
				}

			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				uni.navigateTo({
					url: '/pages/personalCtr/inviteFriends?info=' + e
				})
				this.show = false
			}
		}
	};
</script>

<style lang="scss" scoped>
	/* #ifdef H5 */
	::-webkit-scrollbar {
		display: none;
		width: 0 !important;
		height: 0 !important;
		-webkit-appearance: none;
		background: transparent;
	}

	/* #endif */
	.page_box {
		.content_box {
			.head {
				width: 100vw;
				height: 400rpx;
				background: #92b9b7;

				.tag {
					width: 80rpx;
					height: 30rpx;
					background: linear-gradient(139deg, #393b56, #4f4f62);
					border-radius: 10rpx;
				}
			}

			.agnt {
				background-color: #f7f7f7;

				.agnt-inside {
					width: 340rpx;
					height: 140rpx;
					background: #ffffff;
					border-radius: 20rpx;
				}
			}

			.setUp {
				.setUp-inside {}
			}
		}
	}

	.box-header {
		width: 300rpx;

		.text {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
		}
		
		.radion {
			width: 100%;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
		}
	}
</style>
